<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>



<div class="row">
  <div class="col-md-12" >
      <div class="box">
          <div class="box-header with-border">
              <h3 class="box-title">停销产品</h3>


          </div>
          <div class="box-body">

          <table class="table table-striped table-hover" style="margin-top:20px;">
                                        <thead>
                                            <tr>
                                                <th>图片</th>
                                                <th>名称</th>
                                                <th>价格</th>
                                                <th>站点</th>
                                                <th>90天销量</th>                                             
                                                <th>最近购买</th>
                                            </tr>
                                        </thead>
                                        <tbody>
<?php foreach ($data as $item):?>
<tr>
  <td class="imgcol">
  <?php
  if(isset($item["thumb"]) && $item["thumb"])
  {
      ?>


            <img src=""  data-original="<?php echo $item["thumb"];?>"  class="lazy" height="80"/>

      <?php
  }
  ?>
      </td>

      <?php 
                                            $tmp=explode("-",$item["name"]);
                                            if(count($tmp)>1)
                                            {
                                               $sub = trim(array_pop($tmp));
                                               $qname=str_replace(" - ".$sub,"",$item["name"]);
                                            }
                                            else
                                            {
                                                $qname=$item["name"];
                                            }
                                            $qname=urlencode($qname);
                                            $siteprourl="/backend/sites/product/index/".$item["siteid"]."?keyword=".$qname;
                                            ?>


    <td><a href="<?php echo $siteprourl;?>" target="_blank"><?php echo $item["name"]; ?></a></td>
    <td> <?php echo $item["price"]; ?></td>
    <td><a href="/backend/sites/order/index/<?php echo $item["siteid"];?>" target="_blank"><?php echo $sindex[$item["siteid"]]; ?></a></td>
    <td> <?php echo $item["total"]; ?></td>
    <td> <?php echo $item["lastday"]; ?> </td>
    
<?php endforeach;?>
                                        </tbody>
                                    </table>
                                    <?php 
                                    if(empty($data)){
                                        echo "<h2 style='text-align:center;padding:50px 0;'>没有查询到数据</h2>";
                                    }
                                    ?>
                               


          </div>
      </div>
  </div>

</div>

<script src="/assets/backend/lazyload.js?v=1.9.1"></script>     
<script>
$(document).ready(function(){
    $("img.lazy").lazyload({effect: "fadeIn"});
    requirejs.config({
        paths: {
            jquery: "../../components/jquery/jquery.min",
            viewer: "../../components/viewer/viewer.min",
        },
        shim: {
            viewer: {deps: ["loadcss!../../components/viewer/viewer.min.css"]},        
        }
    });
    require(['jquery','viewer'], function($){
        $('.imgcol img').viewer({});
    });

    $('#sites').select2();

});


</script>
